#include <iostream>
#define MAXN 1000005
using namespace std;
int N, K;
int array[MAXN];

void solve();
int main() {
    cin >> N;
    for (int i = 0; i < N; i++) cin >> array[i];
    cin >> K;
    solve();
}

void solve() {
    // ( ]
    int lower = -1, larger = N;
    while (larger - lower > 1) {
        int middle = (lower + larger) / 2;
        if (array[middle] >= K) {
            larger = middle;
        }
        else {
            lower = middle;
        }
    }
    cout << larger << endl;
}